#!/usr/bin/awk -f
BEGIN {
   FS=","
   summed_latency = 0;
   summed_throughput = 0;
   min_throughput = 999999;
   max_throughput = 0;

   min_latency = 9999999;
   max_throughput = 0;
}

/^[0-9]+[.]*[0-9]*,[0-9]+[.]*[0-9]*,[0-9]+[.]*[0-9]*,[0-9]+[.]*[0-9]*,[0-9]+[.]*[0-9]*$/ {

  if ($4 < min_latency) min_latency = $4;
  if ($4 > max_latency) max_latency = $4;

  if ($5 < min_throughput) min_throughput= $5;
  if ($5 > max_throughput) max_throughput= $5;

  summed_latency += $4;
  summed_throughput += $5;
  num_transactions++;
}

END {
  avg_latency = (summed_latency/num_transactions);
  avg_throughput = (summed_throughput/num_transactions);
  printf("%f,%f,%f,%f,%f,%f\n", min_latency, max_latency, avg_latency, min_throughput, max_throughput, avg_throughput);
}
